// Copyright (c) 2009 Hypirinha contributers
// This program is made available under the terms of the MIT License.
package org.hypirinha.html.output.print;

import static org.hypirinha.html.ElementFactory.html;
import org.hypirinha.html.elements.Html;
import org.hypirinha.html.output.features.HtmlDoctype;
import org.hypirinha.html.output.PrintAdapter;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.junit.Assert;

public class DoctypeTest {

    @Test
    public void shouldIncludeDoctypeIfSupplied() {
        Html content = html();

        String output = new PrintAdapter(HtmlDoctype.xhtml1_transitional).asString(content);

        Assert.assertEquals(MultilineString.lines(
                "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"",
                "       \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">",
                "<html></html>"), output);
    }

}